agent: correct length for uri and comment on 64-bit big-endian platforms
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 14 May 2019 04:05:42 +0000 (00:05 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Fri, 1 Jul 2022 16:06:43 +0000 (17:06 +0100)
commite72f77dd1eb7a5b0077a9065765b5caa5142d382
tree8c286daa0fd0e5ce06497b36db8d38caeecc7b73
parenta5cc15be096eee6b2446626e3057f045ed093d53
agent: correct length for uri and comment on 64-bit big-endian platforms

* agent/findkey.c (agent_public_key_from_file): pass size_t as int to
gcry_sexp_build_array's %b.

--

This is only a problem on big-endian systems where size_t is not the
same size as an int.  It was causing failures on debian's s390x,
powerpc64, and sparc64 platforms.

There may well be other failures with %b on those platforms in the
codebase, and it probably needs an audit.

Once you have a key in private-keys-v1.d/$KEYGRIP.key with a comment
or a uri of reasonable length associated with it, this fix can be
tested with:

   gpg-agent --server <<<"READKEY $KEYGRIP"

On the failing platforms, the printed comment will be of length 0.

Gnupg-bug-id: 4501
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
(cherry picked from commit 110932925ba8e0169da18d7774440f8d1fd8a344)

Gbp-Pq: Topic from-2.2.16
Gbp-Pq: Name agent-correct-length-for-uri-and-comment-on-64-bit-big-en.patch
agent/findkey.c